1 module derelict.sdl2.gfx.gfx; 2 3 import derelict.util.system; 4 import derelict.util.loader; 5 6 import derelict.sdl2.gfx.primitives; 7 import derelict.sdl2.gfx.framerate; 8 import derelict.sdl2.gfx.rotozoom; 9 import derelict.sdl2.gfx.imagefilter; 10 11 private 12 { 13 static if (Derelict_OS_Windows) 14 enum libNames = "SDL2_gfx.dll"; 15 else static if (Derelict_OS_Mac) 16 enum libNames = "/usr/local/lib/libSDL2_gfx.dylib, /usr/local/lib/libSDL2/libSDL2_gfx.dylib, ../Frameworks/SDL2.framework/SDL2_gfx, /Library/Frameworks/SDL2.framework/SDL2_gfx, /System/Library/Frameworks/SDL2.framework/SDL2_gfx"; 17 else static if (Derelict_OS_Posix) 18 enum libNames = "libSDL2_gfx.so, usr/local/lib/libSDL2_gfx.so"; 19 else 20 static assert( 0, "Need to implement SDL2 libNames for this operating system." ); 21 } 22 23 class DerelictSDL2GfxLoader : SharedLibLoader 24 { 25 public this() 26 { 27 super(libNames); 28 } 29 30 protected override void loadSymbols() 31 { 32 // Pixel 33 bindFunc(cast(void **)&pixelColor, "pixelColor"); 34 bindFunc(cast(void **)&pixelRGBA, "pixelRGBA"); 35 36 // Horizontal Line 37 bindFunc(cast(void **)&hlineColor, "hlineColor"); 38 bindFunc(cast(void **)&hlineRGBA, "hlineRGBA"); 39 40 // Vertical Line 41 bindFunc(cast(void **)&vlineColor, "vlineColor"); 42 bindFunc(cast(void **)&vlineRGBA, "vlineRGBA"); 43 44 // Rectangle 45 bindFunc(cast(void **)&rectangleColor, "rectangleColor"); 46 bindFunc(cast(void **)&rectangleRGBA, "rectangleRGBA"); 47 48 // Rounded-Corner Rectangle 49 bindFunc(cast(void **)&roundedRectangleColor, "roundedRectangleColor"); 50 bindFunc(cast(void **)&roundedRectangleRGBA, "roundedRectangleRGBA"); 51 52 // Filled rectangle (Box) 53 bindFunc(cast(void **)&boxColor, "boxColor"); 54 bindFunc(cast(void **)&boxRGBA, "boxRGBA"); 55 56 // Rounded-Corner Filled rectangle (Box) 57 bindFunc(cast(void **)&roundedBoxColor, "roundedBoxColor"); 58 bindFunc(cast(void **)&roundedBoxRGBA, "roundedBoxRGBA"); 59 60 // Line 61 bindFunc(cast(void **)&lineColor, "lineColor"); 62 bindFunc(cast(void **)&lineRGBA, "lineRGBA"); 63 64 // AA Line 65 bindFunc(cast(void **)&aalineColor, "aalineColor"); 66 bindFunc(cast(void **)&aalineRGBA, "aalineRGBA"); 67 68 // Thick Line 69 bindFunc(cast(void **)&thickLineColor, "thickLineColor"); 70 bindFunc(cast(void **)&thickLineRGBA, "thickLineRGBA"); 71 72 // Circle 73 bindFunc(cast(void **)&circleColor, "circleColor"); 74 bindFunc(cast(void **)&circleRGBA, "circleRGBA"); 75 76 // Arc 77 bindFunc(cast(void **)&arcColor, "arcColor"); 78 bindFunc(cast(void **)&arcRGBA, "arcRGBA"); 79 80 // AA Circle 81 bindFunc(cast(void **)&aacircleColor, "aacircleColor"); 82 bindFunc(cast(void **)&aacircleRGBA, "aacircleRGBA"); 83 84 // Filled Circle 85 bindFunc(cast(void **)&filledCircleColor, "filledCircleColor"); 86 bindFunc(cast(void **)&filledCircleRGBA, "filledCircleRGBA"); 87 88 // Ellipse 89 bindFunc(cast(void **)&ellipseColor, "ellipseColor"); 90 bindFunc(cast(void **)&ellipseRGBA, "ellipseRGBA"); 91 92 // AA Ellipse 93 bindFunc(cast(void **)&aaellipseColor, "aaellipseColor"); 94 bindFunc(cast(void **)&aaellipseRGBA, "aaellipseRGBA"); 95 96 // Filled Ellipse 97 bindFunc(cast(void **)&filledEllipseColor, "filledEllipseColor"); 98 bindFunc(cast(void **)&filledEllipseRGBA, "filledEllipseRGBA"); 99 100 // Pie 101 bindFunc(cast(void **)&pieColor, "pieColor"); 102 bindFunc(cast(void **)&pieRGBA, "pieRGBA"); 103 104 // Filled Pie 105 bindFunc(cast(void **)&filledPieColor, "filledPieColor"); 106 bindFunc(cast(void **)&filledPieRGBA, "filledPieRGBA"); 107 108 // Trigon 109 bindFunc(cast(void **)&trigonColor, "trigonColor"); 110 bindFunc(cast(void **)&trigonRGBA, "trigonRGBA"); 111 112 // AA Trigon 113 bindFunc(cast(void **)&aatrigonColor, "aatrigonColor"); 114 bindFunc(cast(void **)&aatrigonRGBA, "aatrigonRGBA"); 115 116 // Filled Trigon 117 bindFunc(cast(void **)&filledTrigonColor, "filledTrigonColor"); 118 bindFunc(cast(void **)&filledTrigonRGBA, "filledTrigonRGBA"); 119 120 // Polygon 121 bindFunc(cast(void **)&polygonColor, "polygonColor"); 122 bindFunc(cast(void **)&polygonRGBA, "polygonRGBA"); 123 124 // AA Polygon 125 bindFunc(cast(void **)&aapolygonColor, "aapolygonColor"); 126 bindFunc(cast(void **)&aapolygonRGBA, "aapolygonRGBA"); 127 128 // Filled Polygon 129 bindFunc(cast(void **)&filledPolygonColor, "filledPolygonColor"); 130 bindFunc(cast(void **)&filledPolygonRGBA, "filledPolygonRGBA"); 131 132 // Textured Polygon 133 bindFunc(cast(void **)&texturedPolygon, "texturedPolygon"); 134 135 // Bezier 136 bindFunc(cast(void **)&bezierColor, "bezierColor"); 137 bindFunc(cast(void **)&bezierRGBA, "bezierRGBA"); 138 139 // Characters/Strings 140 bindFunc(cast(void **)&gfxPrimitivesSetFont, "gfxPrimitivesSetFont"); 141 bindFunc(cast(void **)&gfxPrimitivesSetFontRotation, "gfxPrimitivesSetFontRotation"); 142 bindFunc(cast(void **)&characterColor, "characterColor"); 143 bindFunc(cast(void **)&characterRGBA, "characterRGBA"); 144 bindFunc(cast(void **)&stringColor, "stringColor"); 145 bindFunc(cast(void **)&stringRGBA, "stringRGBA"); 146 147 // Surface Rotozoomer 148 bindFunc(cast(void **)&rotateSurface90Degrees, "rotateSurface90Degrees"); 149 bindFunc(cast(void **)&rotozoomSurfaceSizeXY, "rotozoomSurfaceSizeXY"); 150 bindFunc(cast(void **)&rotozoomSurfaceSize, "rotozoomSurfaceSize"); 151 bindFunc(cast(void **)&rotozoomSurface, "rotozoomSurface"); 152 bindFunc(cast(void **)&rotozoomSurfaceXY, "rotozoomSurfaceXY"); 153 bindFunc(cast(void **)&zoomSurfaceSize, "zoomSurfaceSize"); 154 bindFunc(cast(void **)&zoomSurface, "zoomSurface"); 155 bindFunc(cast(void **)&shrinkSurface, "shrinkSurface"); 156 157 // Framerate control 158 bindFunc(cast(void **)&SDL_initFramerate, "SDL_initFramerate"); 159 bindFunc(cast(void **)&SDL_setFramerate, "SDL_setFramerate"); 160 bindFunc(cast(void **)&SDL_getFramerate, "SDL_getFramerate"); 161 bindFunc(cast(void **)&SDL_getFramecount, "SDL_getFramecount"); 162 bindFunc(cast(void **)&SDL_framerateDelay, "SDL_framerateDelay"); 163 164 // MMX image filters 165 bindFunc(cast(void **)&SDL_imageFilterAbsDiff, "SDL_imageFilterAbsDiff"); 166 bindFunc(cast(void **)&SDL_imageFilterAdd, "SDL_imageFilterAdd"); 167 bindFunc(cast(void **)&SDL_imageFilterAddByte, "SDL_imageFilterAddByte"); 168 bindFunc(cast(void **)&SDL_imageFilterAddByteToHalf, "SDL_imageFilterAddByteToHalf"); 169 bindFunc(cast(void **)&SDL_imageFilterAddUint, "SDL_imageFilterAddUint"); 170 bindFunc(cast(void **)&SDL_imageFilterBinarizeUsingThreshold, "SDL_imageFilterBinarizeUsingThreshold"); 171 bindFunc(cast(void **)&SDL_imageFilterBitAnd, "SDL_imageFilterBitAnd"); 172 bindFunc(cast(void **)&SDL_imageFilterBitNegation, "SDL_imageFilterBitNegation"); 173 bindFunc(cast(void **)&SDL_imageFilterBitOr, "SDL_imageFilterBitOr"); 174 bindFunc(cast(void **)&SDL_imageFilterClipToRange, "SDL_imageFilterClipToRange"); 175 bindFunc(cast(void **)&SDL_imageFilterDiv, "SDL_imageFilterDiv"); 176 bindFunc(cast(void **)&SDL_imageFilterMMXdetect, "SDL_imageFilterMMXdetect"); 177 bindFunc(cast(void **)&SDL_imageFilterMMXoff, "SDL_imageFilterMMXoff"); 178 bindFunc(cast(void **)&SDL_imageFilterMMXon, "SDL_imageFilterMMXon"); 179 bindFunc(cast(void **)&SDL_imageFilterMean, "SDL_imageFilterMean"); 180 bindFunc(cast(void **)&SDL_imageFilterMult, "SDL_imageFilterMult"); 181 bindFunc(cast(void **)&SDL_imageFilterMultByByte, "SDL_imageFilterMultByByte"); 182 bindFunc(cast(void **)&SDL_imageFilterMultDivby2, "SDL_imageFilterMultDivby2"); 183 bindFunc(cast(void **)&SDL_imageFilterMultDivby4, "SDL_imageFilterMultDivby4"); 184 bindFunc(cast(void **)&SDL_imageFilterMultNor, "SDL_imageFilterMultNor"); 185 bindFunc(cast(void **)&SDL_imageFilterNormalizeLinear, "SDL_imageFilterNormalizeLinear"); 186 bindFunc(cast(void **)&SDL_imageFilterShiftLeft, "SDL_imageFilterShiftLeft"); 187 bindFunc(cast(void **)&SDL_imageFilterShiftLeftByte, "SDL_imageFilterShiftLeftByte"); 188 bindFunc(cast(void **)&SDL_imageFilterShiftLeftUint, "SDL_imageFilterShiftLeftUint"); 189 bindFunc(cast(void **)&SDL_imageFilterShiftRight, "SDL_imageFilterShiftRight"); 190 bindFunc(cast(void **)&SDL_imageFilterShiftRightAndMultByByte, "SDL_imageFilterShiftRightAndMultByByte"); 191 bindFunc(cast(void **)&SDL_imageFilterShiftRightUint, "SDL_imageFilterShiftRightUint"); 192 bindFunc(cast(void **)&SDL_imageFilterSub, "SDL_imageFilterSub"); 193 bindFunc(cast(void **)&SDL_imageFilterSubByte, "SDL_imageFilterSubByte"); 194 bindFunc(cast(void **)&SDL_imageFilterSubUint, "SDL_imageFilterSubUint"); 195 } 196 } 197 198 __gshared DerelictSDL2GfxLoader DerelictSDL2Gfx; 199 200 shared static this() 201 { 202 DerelictSDL2Gfx = new DerelictSDL2GfxLoader(); 203 } 204